package tsing.javase.thread.sync.scheduler;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import tsing.javase.thread.sync.service.SyncDemoService;

/**
 * @Date 2023/10/25 16:51
 */
@Component
public class SyncDemoScheduler {

    @Autowired
    SyncDemoService service;
    /**
     * 每隔10分钟查询告警任务，并执行
     *
     * @throws Exception
     */
    @Scheduled(cron=" 0 0/2 * * * ?")
    public void vipNewAlarmMethod() throws Exception{
        System.out.println("i'm running!");
        // 调异步方法
        service.prints();
    }
}
